package org.restorator.dao.jdbc;

import org.restorator.exception.DataStoreException;

/**
 *
 * @author Snisar Bogdan
 */
public interface Enricher<E> {

    public static Enricher NULL = new Enricher() {

        @Override
        public void enrich(Object enrichable) {
        }

        @Override
        public void insert(Object obj) {
            //ignored
        }

        @Override
        public void update(Object obj) {
        }

        @Override
        public void delete(Object obj) {
            //To change body of implemented methods use File | Settings | File Templates.
        }
    };

    /**
     * Enrich entity by entities composition classes.
     * @param enrichable entity for enriching
     * @return entity after enriching.
     */
    void enrich(E enrichable) throws DataStoreException;

    /**
     * Insert entities references.
     *
     */
    void insert(E obj);

    /**
     * Update entity's references
     *
     * @param obj
     */
    void update(E obj);

    /**
     * Delete entity. Entity must have id.
     * @param obj
     */
    void delete(E obj);
}
